#include <iostream>
using namespace std;
int FindNum(int str[100],int);

int main()
{
    int str[100];
    int i,n;
    cin>>n;
    cout<<FindNum(str,n)<<endl;

    return 0;
}

int FindNum(int str[100],int n)
{
    if(0==n/10)
    {
        return n;
    }
    int i,divi=10,sum=1;
    for(i=0;0!=n/(divi/10);i++)
    {
        str[i]=(n%divi)/(divi/10);
        divi*=10;
    }
    str[i]='\0';
    for(i=0;str[i]!='\0';i++)
    {
        if(0==str[i])
            continue;
        else
            sum*=str[i];
    }
    return FindNum(str,sum);

}
